<template>
  <div :class="className" :style="{height:height,width:width}" />
</template>

<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from '../../dashboard/mixins/resize'
// import {transform} from 'echarts-stat';
// echarts.registerTransform(transform.histogram);

const data = [[
  [1.00E+04,132.04],[1.40E+04,118.72],[1.80E+04,109.65],[2.19E+04,102.90],[2.59E+04, 97.59],[2.99E+04, 93.27],[3.39E+04, 89.64],[3.78E+04, 86.53],[4.18E+04, 83.83],[4.58E+04, 81.44],[4.98E+04, 79.32],[5.37E+04, 77.41],[5.77E+04, 75.67],[6.17E+04, 74.09],[6.57E+04, 72.63],[6.96E+04, 71.29],[7.36E+04, 70.04],[7.76E+04, 68.88],[8.16E+04, 67.80],[8.55E+04, 66.78],[8.95E+04, 65.82],[9.35E+04, 64.92],[9.75E+04, 64.07],[1.01E+05, 63.26],[1.05E+05, 62.49],[1.09E+05, 61.76],[1.13E+05, 61.06],[1.17E+05, 60.40],[1.21E+05, 59.76],[1.25E+05, 59.15],[1.29E+05, 58.57],[1.33E+05, 58.01],[1.37E+05, 57.47],[1.41E+05, 56.95],[1.45E+05, 56.45],[1.49E+05, 55.97],[1.53E+05, 55.50],[1.57E+05, 55.05],[1.61E+05, 54.62],[1.65E+05, 54.20],[1.69E+05, 53.79],[1.73E+05, 53.39],[1.77E+05, 53.01],[1.81E+05, 52.64],[1.85E+05, 52.27],[1.89E+05, 51.92],[1.93E+05, 51.58],[1.97E+05, 51.25],[2.01E+05, 50.92],[2.05E+05, 50.61],[2.09E+05, 50.30],[2.13E+05, 50.00],[2.17E+05, 49.70],[2.21E+05, 49.42],[2.25E+05, 49.14],[2.29E+05, 48.87],[2.33E+05, 48.60],[2.37E+05, 48.34],[2.41E+05, 48.08],[2.45E+05, 47.83],[2.49E+05, 47.59],[2.53E+05, 47.35],[2.56E+05, 47.11],[2.60E+05, 46.89],[2.64E+05, 46.66],[2.68E+05, 46.44],[2.72E+05, 46.22],[2.76E+05, 46.01],[2.80E+05, 45.80],[2.84E+05, 45.60],[2.88E+05, 45.40],[2.92E+05, 45.20],[2.96E+05, 45.01],[3.00E+05, 44.82],[3.04E+05, 44.63],[3.08E+05, 44.45],[3.12E+05, 44.27],[3.16E+05, 44.09],[3.20E+05, 43.91],[3.24E+05, 43.74],[3.28E+05, 43.57],[3.32E+05, 43.41],[3.36E+05, 43.24],[3.40E+05, 43.08],[3.44E+05, 42.92],[3.48E+05, 42.77],[3.52E+05, 42.61],[3.56E+05, 42.46],[3.60E+05, 42.31],[3.64E+05, 42.16],[3.68E+05, 42.02],[3.72E+05, 41.87],[3.76E+05, 41.73],[3.80E+05, 41.59],[3.84E+05, 41.46],[3.88E+05, 41.32],[3.92E+05, 41.19],[3.96E+05, 41.06],[4.00E+05, 40.93],[4.04E+05, 40.80],[1.05E+07, 22.05],[2.06E+07, 19.42],[3.07E+07, 18.01],[4.08E+07, 17.07],[5.09E+07, 16.37],[6.10E+07, 15.82],[7.11E+07, 15.37],[8.12E+07, 14.99],[9.13E+07, 14.66],[1.01E+08, 14.37],[1.11E+08, 14.12],[1.22E+08, 13.89],[1.32E+08, 13.68],[1.42E+08, 13.49],[1.52E+08, 13.32],[1.62E+08, 13.16],[1.72E+08, 13.01],[1.82E+08, 12.87],[1.92E+08, 12.74],[2.02E+08, 12.61],[2.12E+08, 12.50],[2.23E+08, 12.39],[2.33E+08, 12.29],[2.43E+08, 12.19],[2.53E+08, 12.09],[2.63E+08, 12.01],[2.73E+08, 11.92],[2.83E+08, 11.84],[2.93E+08, 11.76],[3.03E+08, 11.69],[3.13E+08, 11.61],[3.24E+08, 11.54],[3.34E+08, 11.48],[3.44E+08, 11.41],[3.54E+08, 11.35],[3.64E+08, 11.29],[3.74E+08, 11.23],[3.84E+08, 11.18],[3.94E+08, 11.12],[4.04E+08, 11.07],[4.14E+08, 11.02],[4.24E+08, 10.97],[4.35E+08, 10.92],[4.45E+08, 10.87],[4.55E+08, 10.83],[4.65E+08, 10.78],[4.75E+08, 10.74],[4.85E+08, 10.69],[4.95E+08, 10.65],[5.05E+08, 10.61],[5.15E+08, 10.57],[5.25E+08, 10.53],[5.36E+08, 10.50],[5.46E+08, 10.46],[5.56E+08, 10.42],[5.66E+08, 10.39],[5.76E+08, 10.35],[5.86E+08, 10.32],[5.96E+08, 10.29],[6.06E+08, 10.25],[6.16E+08, 10.22],[6.26E+08, 10.19],[6.37E+08, 10.16],[6.47E+08, 10.13],[6.57E+08, 10.10],[6.67E+08, 10.07],[6.77E+08, 10.04],[6.87E+08, 10.01],[6.97E+08,  9.99],[7.07E+08,  9.96],[7.17E+08,  9.93],[7.27E+08,  9.91],[7.37E+08,  9.88],[7.48E+08,  9.86],[7.58E+08,  9.83],[7.68E+08,  9.81],[7.78E+08,  9.78],[7.88E+08,  9.76],[7.98E+08,  9.74],[8.08E+08,  9.71],[8.18E+08,  9.69],[8.28E+08,  9.67],[8.38E+08,  9.64],[8.49E+08,  9.62],[8.59E+08,  9.60],[8.69E+08,  9.58],[8.79E+08,  9.56],[8.89E+08,  9.54],[8.99E+08,  9.52],[9.09E+08,  9.50],[9.19E+08,  9.48],[9.29E+08,  9.46],[9.39E+08,  9.44],[9.50E+08,  9.42],[9.60E+08,  9.40],[9.70E+08,  9.38],[9.80E+08,  9.37],[9.90E+08,  9.35],[1.00E+09,  9.33]
],[
  [2.00E+04,132.04],[2.40E+04,118.72],[2.80E+04,109.65],[3.19E+04,102.90],[2.59E+04, 97.59],[2.99E+04, 93.27],[3.39E+04, 89.64],[3.78E+04, 86.53],[4.18E+04, 83.83],[4.58E+04, 81.44],[4.98E+04, 79.32],[5.37E+04, 77.41],[5.77E+04, 75.67],[6.17E+04, 74.09],[6.57E+04, 72.63],[6.96E+04, 71.29],[7.36E+04, 70.04],[7.76E+04, 68.88],[8.16E+04, 67.80],[8.55E+04, 66.78],[8.95E+04, 65.82],[9.35E+04, 64.92],[9.75E+04, 64.07],[1.01E+05, 63.26],[1.05E+05, 62.49],[1.09E+05, 61.76],[1.13E+05, 61.06],[1.17E+05, 60.40],[1.21E+05, 59.76],[1.25E+05, 59.15],[1.29E+05, 58.57],[1.33E+05, 58.01],[1.37E+05, 57.47],[1.41E+05, 56.95],[1.45E+05, 56.45],[1.49E+05, 55.97],[1.53E+05, 55.50],[1.57E+05, 55.05],[1.61E+05, 54.62],[1.65E+05, 54.20],[1.69E+05, 53.79],[1.73E+05, 53.39],[1.77E+05, 53.01],[1.81E+05, 52.64],[1.85E+05, 52.27],[1.89E+05, 51.92],[1.93E+05, 51.58],[1.97E+05, 51.25],[2.01E+05, 50.92],[2.05E+05, 50.61],[2.09E+05, 50.30],[2.13E+05, 50.00],[2.17E+05, 49.70],[2.21E+05, 49.42],[2.25E+05, 49.14],[2.29E+05, 48.87],[2.33E+05, 48.60],[2.37E+05, 48.34],[2.41E+05, 48.08],[2.45E+05, 47.83],[2.49E+05, 47.59],[2.53E+05, 47.35],[2.56E+05, 47.11],[2.60E+05, 46.89],[2.64E+05, 46.66],[2.68E+05, 46.44],[2.72E+05, 46.22],[2.76E+05, 46.01],[2.80E+05, 45.80],[2.84E+05, 45.60],[2.88E+05, 45.40],[2.92E+05, 45.20],[2.96E+05, 45.01],[3.00E+05, 44.82],[3.04E+05, 44.63],[3.08E+05, 44.45],[3.12E+05, 44.27],[3.16E+05, 44.09],[3.20E+05, 43.91],[3.24E+05, 43.74],[3.28E+05, 43.57],[3.32E+05, 43.41],[3.36E+05, 43.24],[3.40E+05, 43.08],[3.44E+05, 42.92],[3.48E+05, 42.77],[3.52E+05, 42.61],[3.56E+05, 42.46],[3.60E+05, 42.31],[3.64E+05, 42.16],[3.68E+05, 42.02],[3.72E+05, 41.87],[3.76E+05, 41.73],[3.80E+05, 41.59],[3.84E+05, 41.46],[3.88E+05, 41.32],[3.92E+05, 41.19],[3.96E+05, 41.06],[4.00E+05, 40.93],[4.04E+05, 40.80],[1.05E+07, 22.05],[2.06E+07, 19.42],[3.07E+07, 18.01],[4.08E+07, 17.07],[5.09E+07, 16.37],[6.10E+07, 15.82],[7.11E+07, 15.37],[8.12E+07, 14.99],[9.13E+07, 14.66],[1.01E+08, 14.37],[1.11E+08, 14.12],[1.22E+08, 13.89],[1.32E+08, 13.68],[1.42E+08, 13.49],[1.52E+08, 13.32],[1.62E+08, 13.16],[1.72E+08, 13.01],[1.82E+08, 12.87],[1.92E+08, 12.74],[2.02E+08, 12.61],[2.12E+08, 12.50],[2.23E+08, 12.39],[2.33E+08, 12.29],[2.43E+08, 12.19],[2.53E+08, 12.09],[2.63E+08, 12.01],[2.73E+08, 11.92],[2.83E+08, 11.84],[2.93E+08, 11.76],[3.03E+08, 11.69],[3.13E+08, 11.61],[3.24E+08, 11.54],[3.34E+08, 11.48],[3.44E+08, 11.41],[3.54E+08, 11.35],[3.64E+08, 11.29],[3.74E+08, 11.23],[3.84E+08, 11.18],[3.94E+08, 11.12],[4.04E+08, 11.07],[4.14E+08, 11.02],[4.24E+08, 10.97],[4.35E+08, 10.92],[4.45E+08, 10.87],[4.55E+08, 10.83],[4.65E+08, 10.78],[4.75E+08, 10.74],[4.85E+08, 10.69],[4.95E+08, 10.65],[5.05E+08, 10.61],[5.15E+08, 10.57],[5.25E+08, 10.53],[5.36E+08, 10.50],[5.46E+08, 10.46],[5.56E+08, 10.42],[5.66E+08, 10.39],[5.76E+08, 10.35],[5.86E+08, 10.32],[5.96E+08, 10.29],[6.06E+08, 10.25],[6.16E+08, 10.22],[6.26E+08, 10.19],[6.37E+08, 10.16],[6.47E+08, 10.13],[6.57E+08, 10.10],[6.67E+08, 10.07],[6.77E+08, 10.04],[6.87E+08, 10.01],[6.97E+08,  9.99],[7.07E+08,  9.96],[7.17E+08,  9.93],[7.27E+08,  9.91],[7.37E+08,  9.88],[7.48E+08,  9.86],[7.58E+08,  9.83],[7.68E+08,  9.81],[7.78E+08,  9.78],[7.88E+08,  9.76],[7.98E+08,  9.74],[8.08E+08,  9.71],[8.18E+08,  9.69],[8.28E+08,  9.67],[8.38E+08,  9.64],[8.49E+08,  9.62],[8.59E+08,  9.60],[8.69E+08,  9.58],[8.79E+08,  9.56],[8.89E+08,  9.54],[8.99E+08,  9.52],[9.09E+08,  9.50],[9.19E+08,  9.48],[9.29E+08,  9.46],[9.39E+08,  9.44],[9.50E+08,  9.42],[9.60E+08,  9.40],[9.70E+08,  9.38],[9.80E+08,  9.37],[9.90E+08,  9.35],[1.00E+09,  9.33]
],[
  [7.00E+04,732.04],[7.40E+04,118.72],[7.80E+04,109.65],[7.19E+04,102.90],[2.59E+04, 97.59],[2.99E+04, 93.27],[3.39E+04, 89.64],[3.78E+04, 86.53],[4.18E+04, 83.83],[4.58E+04, 81.44],[4.98E+04, 79.32],[5.37E+04, 77.41],[5.77E+04, 75.67],[6.17E+04, 74.09],[6.57E+04, 72.63],[6.96E+04, 71.29],[7.36E+04, 70.04],[7.76E+04, 68.88],[8.16E+04, 67.80],[8.55E+04, 66.78],[8.95E+04, 65.82],[9.35E+04, 64.92],[9.75E+04, 64.07],[1.01E+05, 63.26],[1.05E+05, 62.49],[1.09E+05, 61.76],[1.13E+05, 61.06],[1.17E+05, 60.40],[1.21E+05, 59.76],[1.25E+05, 59.15],[1.29E+05, 58.57],[1.33E+05, 58.01],[1.37E+05, 57.47],[1.41E+05, 56.95],[1.45E+05, 56.45],[1.49E+05, 55.97],[1.53E+05, 55.50],[1.57E+05, 55.05],[1.61E+05, 54.62],[1.65E+05, 54.20],[1.69E+05, 53.79],[1.73E+05, 53.39],[1.77E+05, 53.01],[1.81E+05, 52.64],[1.85E+05, 52.27],[1.89E+05, 51.92],[1.93E+05, 51.58],[1.97E+05, 51.25],[2.01E+05, 50.92],[2.05E+05, 50.61],[2.09E+05, 50.30],[2.13E+05, 50.00],[2.17E+05, 49.70],[2.21E+05, 49.42],[2.25E+05, 49.14],[2.29E+05, 48.87],[2.33E+05, 48.60],[2.37E+05, 48.34],[2.41E+05, 48.08],[2.45E+05, 47.83],[2.49E+05, 47.59],[2.53E+05, 47.35],[2.56E+05, 47.11],[2.60E+05, 46.89],[2.64E+05, 46.66],[2.68E+05, 46.44],[2.72E+05, 46.22],[2.76E+05, 46.01],[2.80E+05, 45.80],[2.84E+05, 45.60],[2.88E+05, 45.40],[2.92E+05, 45.20],[2.96E+05, 45.01],[3.00E+05, 44.82],[3.04E+05, 44.63],[3.08E+05, 44.45],[3.12E+05, 44.27],[3.16E+05, 44.09],[3.20E+05, 43.91],[3.24E+05, 43.74],[3.28E+05, 43.57],[3.32E+05, 43.41],[3.36E+05, 43.24],[3.40E+05, 43.08],[3.44E+05, 42.92],[3.48E+05, 42.77],[3.52E+05, 42.61],[3.56E+05, 42.46],[3.60E+05, 42.31],[3.64E+05, 42.16],[3.68E+05, 42.02],[3.72E+05, 41.87],[3.76E+05, 41.73],[3.80E+05, 41.59],[3.84E+05, 41.46],[3.88E+05, 41.32],[3.92E+05, 41.19],[3.96E+05, 41.06],[4.00E+05, 40.93],[4.04E+05, 40.80],[1.05E+07, 22.05],[2.06E+07, 19.42],[3.07E+07, 18.01],[4.08E+07, 17.07],[5.09E+07, 16.37],[6.10E+07, 15.82],[7.11E+07, 15.37],[8.12E+07, 14.99],[9.13E+07, 14.66],[1.01E+08, 14.37],[1.11E+08, 14.12],[1.22E+08, 13.89],[1.32E+08, 13.68],[1.42E+08, 13.49],[1.52E+08, 13.32],[1.62E+08, 13.16],[1.72E+08, 13.01],[1.82E+08, 12.87],[1.92E+08, 12.74],[2.02E+08, 12.61],[2.12E+08, 12.50],[2.23E+08, 12.39],[2.33E+08, 12.29],[2.43E+08, 12.19],[2.53E+08, 12.09],[2.63E+08, 12.01],[2.73E+08, 11.92],[2.83E+08, 11.84],[2.93E+08, 11.76],[3.03E+08, 11.69],[3.13E+08, 11.61],[3.24E+08, 11.54],[3.34E+08, 11.48],[3.44E+08, 11.41],[3.54E+08, 11.35],[3.64E+08, 11.29],[3.74E+08, 11.23],[3.84E+08, 11.18],[3.94E+08, 11.12],[4.04E+08, 11.07],[4.14E+08, 11.02],[4.24E+08, 10.97],[4.35E+08, 10.92],[4.45E+08, 10.87],[4.55E+08, 10.83],[4.65E+08, 10.78],[4.75E+08, 10.74],[4.85E+08, 10.69],[4.95E+08, 10.65],[5.05E+08, 10.61],[5.15E+08, 10.57],[5.25E+08, 10.53],[5.36E+08, 10.50],[5.46E+08, 10.46],[5.56E+08, 10.42],[5.66E+08, 10.39],[5.76E+08, 10.35],[5.86E+08, 10.32],[5.96E+08, 10.29],[6.06E+08, 10.25],[6.16E+08, 10.22],[6.26E+08, 10.19],[6.37E+08, 10.16],[6.47E+08, 10.13],[6.57E+08, 10.10],[6.67E+08, 10.07],[6.77E+08, 10.04],[6.87E+08, 10.01],[6.97E+08,  9.99],[7.07E+08,  9.96],[7.17E+08,  9.93],[7.27E+08,  9.91],[7.37E+08,  9.88],[7.48E+08,  9.86],[7.58E+08,  9.83],[7.68E+08,  9.81],[7.78E+08,  9.78],[7.88E+08,  9.76],[7.98E+08,  9.74],[8.08E+08,  9.71],[8.18E+08,  9.69],[8.28E+08,  9.67],[8.38E+08,  9.64],[8.49E+08,  9.62],[8.59E+08,  9.60],[8.69E+08,  9.58],[8.79E+08,  9.56],[8.89E+08,  9.54],[8.99E+08,  9.52],[9.09E+08,  9.50],[9.19E+08,  9.48],[9.29E+08,  9.46],[9.39E+08,  9.44],[9.50E+08,  9.42],[9.60E+08,  9.40],[9.70E+08,  9.38],[9.80E+08,  9.37],[9.90E+08,  9.35],[1.00E+09,  9.33]
]];
export default {
  mixins: [resize],
  props: {
    className: {
      type: String,
      default: 'chart'
    },
    width: {
      type: String,
      default: '100%'
    },
    height: {
      type: String,
      default: window.innerHeight-230+'px'
    },
    autoResize: {
      type: Boolean,
      default: true
    },
    chartData: {
      type: Object
    }
  },
  data() {
    return {
      chart: null,
      colors:["#de94de","#10a0ff","#d83006","#ffba0c","#22c119"],
      Options: {
          dataset: []
      },
      serData: []
    }
  },
  watch: {
    chartData: {
      deep: true,
      handler(val) {
        this.setOptions(val)
      }
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.initChart()
    })
  },
  beforeDestroy() {
    if (!this.chart) {
      return
    }
    this.chart.dispose()
    this.chart = null
  },
  methods: {
    initChart() {
      this.serData=[]
      this.width = "1200px !important"
      this.chart = echarts.init(this.$el, 'macarons')
      for(var i=0;i<this.chartData.data.length;i++){
        var d = {
              symbolSize: 2,
              symbol: 'circle', //将小圆点改成实心 不写symbol默认空心
              name: '22',
              type: 'line',
              data: this.chartData.data[i], // 这里的data传入所有点的坐标就好
              lineStyle: { color: this.colors[i] }
          }
          this.serData.push(d)
      }
      this.setOptions(this.chartData)
    },
    setOptions(chartData) {
      this.chart.setOption(
        {
          title: {
              text: chartData.title,
              left: 'center'
          },
          legend: {
            show:false,
            left: 10
          },
          tooltip: {
            show:false,
            trigger: 'axis',
            axisPointer: {
              type: 'cross'
            }

          },
          xAxis: {
            show: true,                //是否显示 x 轴
            gridIndex: 0,              //x 轴所在的 grid 的索引，默认位于第一个 grid
            position: "bottom",       //x 轴的位置。"top"，"bottom"，默认 grid 中的第一个 x 轴在 grid 的下方（'bottom'），第二个 x 轴视第一个 x 轴的位置放在另一侧
            offset: 0,                 //X 轴相对于默认位置的偏移，在相同的 position 上有多个 X 轴的时候有用
            type: "log",         //坐标轴类型。'value' 数值轴，适用于连续数据。'category' 类目轴，适用于离散的类目数据，为该类型时必须通过 data 设置类目数据。
            // 'time' 时间轴，适用于连续的时序数据，与数值轴相比时间轴带有时间的格式化，在刻度计算上也有所不同，例如会根据跨度的范围来决定使用月，星期，日还是小时范围的刻度。'log' 对数轴。适用于对数数据
            name: chartData.xData,               //坐标轴名称
            nameLocation: "middle",       //坐标轴名称显示位置。可选：'start','middle','end'

            nameGap: 35,                  //坐标轴名称与轴线之间的距离
            nameRotate: 0,                //坐标轴名字旋转，角度值
            inverse: false,              //是否是反向坐标轴
            boundaryGap: true,           //类目轴中 boundaryGap 可以配置为 true 和 false。非类目轴，包括时间，数值，对数轴，boundaryGap是一个两个值的数组，分别表示数据最小值和最大值的延伸范围，可以直接设置数值或者相对的百分比，在设置 min 和 max 后无效['20%', '20%']
            min: null,                    //坐标轴刻度最小值。可以设置成特殊值 'dataMin'，此时取数据在该轴上的最小值作为最小刻度。不设置时会自动计算最小值保证坐标轴刻度的均匀分布。在类目轴中，也可以设置为类目的序数
            max: null,                   //坐标轴刻度最大值。可以设置成特殊值 'dataMax'，此时取数据在该轴上的最大值作为最大刻度。不设置时会自动计算最大值保证坐标轴刻度的均匀分布。在类目轴中，也可以设置为类目的序数
            scale: false,                //只在数值轴中（type: 'value'）有效。是否是脱离 0 值比例。设置成 true 后坐标刻度不会强制包含零刻度。在双数值轴的散点图中比较有用。在设置 min 和 max 之后该配置项无效。
            splitNumber: 5,             //坐标轴的分割段数，需要注意的是这个分割段数只是个预估值，最后实际显示的段数会在这个基础上根据分割后坐标轴刻度显示的易读程度作调整
            minInterval: 0,             //自动计算的坐标轴最小间隔大小,例如可以设置成1保证坐标轴分割刻度显示成整数。只在数值轴中（type: 'value'）有效。
            logBase: 10,                 //对数轴的底数，只在对数轴中（type: 'log'）有效
            silent: false,              //坐标轴是否是静态无法交互
            triggerEvent: false,       //坐标轴的标签是否响应和触发鼠标事件
            axisLine: {                 //坐标 轴线
               show: true,             //是否显示坐标轴轴线
               onZero: true           //X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上，只有在另一个轴为数值轴且包含 0 刻度时有效

            },
            axisTick: {                 //坐标轴刻度相关设置
               show: true,              //是否显示坐标轴刻度。
               alignWithLabel: false,  //类目轴中在 boundaryGap 为 true 的时候有效，可以保证刻度线和标签对齐
               interval: 0,          //坐标轴刻度的显示间隔，在类目轴中有效。默认会采用标签不重叠的策略间隔显示标签。可以设置成 0 强制显示所有标签。如果设置为 1，表示『隔一个标签显示一个标签』，如果值为 2，表示隔两个标签显示一个标签，以此类推
               inside: true,           //坐标轴刻度是否朝内，默认朝外。
               length: 5                //坐标轴刻度的长度。
            },
            axisLabel: {
               formatter: function (value) {
                  return value.toExponential(2).toUpperCase(); // 使用toExponential转换为科学计数法，保留2位小数
               }
            }
          },
          yAxis: [
              {
                show: true,                //是否显示 x 轴
                gridIndex: 0,              //x 轴所在的 grid 的索引，默认位于第一个 grid
                position: "bottom",       //x 轴的位置。"top"，"bottom"，默认 grid 中的第一个 x 轴在 grid 的下方（'bottom'），第二个 x 轴视第一个 x 轴的位置放在另一侧
                offset: 0,                 //X 轴相对于默认位置的偏移，在相同的 position 上有多个 X 轴的时候有用
                type: "log",         //坐标轴类型。'value' 数值轴，适用于连续数据。'category' 类目轴，适用于离散的类目数据，为该类型时必须通过 data 设置类目数据。
                // 'time' 时间轴，适用于连续的时序数据，与数值轴相比时间轴带有时间的格式化，在刻度计算上也有所不同，例如会根据跨度的范围来决定使用月，星期，日还是小时范围的刻度。'log' 对数轴。适用于对数数据
                name: chartData.yData,               //坐标轴名称
                nameLocation: "end",       //坐标轴名称显示位置。可选：'start','middle','end'

                nameGap: 15,                  //坐标轴名称与轴线之间的距离
                nameRotate: 0,                //坐标轴名字旋转，角度值
                inverse: false,              //是否是反向坐标轴
                boundaryGap: true,           //类目轴中 boundaryGap 可以配置为 true 和 false。非类目轴，包括时间，数值，对数轴，boundaryGap是一个两个值的数组，分别表示数据最小值和最大值的延伸范围，可以直接设置数值或者相对的百分比，在设置 min 和 max 后无效['20%', '20%']
                min: null,                    //坐标轴刻度最小值。可以设置成特殊值 'dataMin'，此时取数据在该轴上的最小值作为最小刻度。不设置时会自动计算最小值保证坐标轴刻度的均匀分布。在类目轴中，也可以设置为类目的序数
                max: null,                   //坐标轴刻度最大值。可以设置成特殊值 'dataMax'，此时取数据在该轴上的最大值作为最大刻度。不设置时会自动计算最大值保证坐标轴刻度的均匀分布。在类目轴中，也可以设置为类目的序数
                scale: false,                //只在数值轴中（type: 'value'）有效。是否是脱离 0 值比例。设置成 true 后坐标刻度不会强制包含零刻度。在双数值轴的散点图中比较有用。在设置 min 和 max 之后该配置项无效。
                splitNumber: 5,             //坐标轴的分割段数，需要注意的是这个分割段数只是个预估值，最后实际显示的段数会在这个基础上根据分割后坐标轴刻度显示的易读程度作调整
                minInterval: 0,             //自动计算的坐标轴最小间隔大小,例如可以设置成1保证坐标轴分割刻度显示成整数。只在数值轴中（type: 'value'）有效。
                logBase: 10,                 //对数轴的底数，只在对数轴中（type: 'log'）有效
                silent: false,              //坐标轴是否是静态无法交互
                triggerEvent: false,       //坐标轴的标签是否响应和触发鼠标事件
                axisLine: {                 //坐标 轴线
                   show: true,             //是否显示坐标轴轴线
                   onZero: true           //X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上，只有在另一个轴为数值轴且包含 0 刻度时有效

                },
                axisTick: {                 //坐标轴刻度相关设置
                   show: true,              //是否显示坐标轴刻度。
                   alignWithLabel: false,  //类目轴中在 boundaryGap 为 true 的时候有效，可以保证刻度线和标签对齐
                   interval: 0,          //坐标轴刻度的显示间隔，在类目轴中有效。默认会采用标签不重叠的策略间隔显示标签。可以设置成 0 强制显示所有标签。如果设置为 1，表示『隔一个标签显示一个标签』，如果值为 2，表示隔两个标签显示一个标签，以此类推
                   inside: true,           //坐标轴刻度是否朝内，默认朝外。
                   length: 5                //坐标轴刻度的长度。
                },
                axisLabel: {
                   formatter: function (value) {
                      return value.toExponential(2).toUpperCase(); // 使用toExponential转换为科学计数法，保留2位小数
                   }
                }
              },
              {
                  splitLine: {
                      lineStyle: {
                          type: 'dashed'
                      }
                  }
              },
              {
                  splitLine: {
                      lineStyle: {
                          type: 'dashed'
                      }
                  }
              }],
          series: this.serData
      }
      )
    }
  }
}
</script>
